from django.urls import path, include
from web.views import account
from web.views import home
from web.views import project
from web.views import manage
from web.views import wiki

urlpatterns = [
    # 加name方便反向解析
    path('register/', account.register, name='register'),
    # 邮箱登录
    path('login/email/', account.login_email, name='login_email'),
    # 用户名密码登录
    path('login/', account.login, name='login'),
    path('send/email/', account.send_email, name='send_email'),
    # 生成图片验证码
    path('image/code/', account.image_code, name='image_code'),
    # 注销
    path('logout/', account.logout, name='logout'),

    # 首页
    path('index/', home.index, name='index'),

    # 项目列表
    path('project/list/', project.project_list, name='project_list'),
    path('project/add/', project.project_add, name='project_add'),
    path('project/star/<str:project_type>/<int:project_id>', project.project_star, name='project_star'),
    path('project/unstar/<str:project_type>/<int:project_id>', project.project_unstar, name='project_unstar'),

    # 项目管理
    path('manage/<int:project_id>/', include([
        path('dashboard/', manage.dashboard, name='dashboard'),
        path('issues/', manage.issues, name='issues'),
        path('statistics/', manage.statistics, name='statistics'),
        path('file/', manage.file, name='file'),

        path('wiki/', wiki.wiki, name='wiki'),
        path('wiki/add/', wiki.wiki_add, name='wiki_add'),
        path('wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        path('wiki/delete/<int:wiki_id>/', wiki.wiki_delete, name='wiki_delete'),
        path('wiki/edit/<int:wiki_id>/', wiki.wiki_edit, name='wiki_edit'),
        path('wiki/upload/', wiki.wiki_upload, name='wiki_upload'),

        path('setting/', manage.setting, name='setting'),
    ])),
]
'''
    path('manage/<int:project_id>/dashboard/', project.project_star, name='project_star'),
    path('manage/<int:project_id>/issues/', project.project_star, name='project_star'),
    path('manage/<int:project_id>/statistics/', project.project_star, name='project_star'),
    path('manage/<int:project_id>/file/', project.project_star, name='project_star'),
    path('manage/<int:project_id>/wiki/', project.project_star, name='project_star'),
    path('manage/<int:project_id>/setting/', project.project_star, name='project_star'),
'''